package com.sxt.controller;

import com.sxt.common.validator.ValidatorUtil;
import com.sxt.domain.BusRent;
import com.sxt.query.BusRentQuery;
import com.sxt.service.BusRentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 车辆出租记录控制类
 */
@RestController
@RequestMapping("rent")
public class BusRentController {
    @Autowired
    private BusRentService busRentService;

    /**
     * 新增车辆出租记录
     *
     * @param busRent
     * @return
     */
    @RequestMapping("add.do")
    public Object add(BusRent busRent) {
        // 数据校验
        ValidatorUtil.validator(busRent);
        return busRentService.add(busRent);
    }

    /**
     * 出租记录的分页查询
     *
     * @param query
     * @return
     */
    @RequestMapping("page.do")
    public Object page(BusRentQuery query) {
        return busRentService.queryPage(query);
    }

}
